package com.dqp.cslggroup.UI;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.dqp.cslggroup.R;
import com.dqp.cslggroup.SmartTableInfo.dakaInfo;

import java.util.List;

public class twoTextViewAdapter extends BaseAdapter {
    private List<dakaInfo> infos;
    private LayoutInflater inflater;
    private twoTextViewAdapter twoTextViewAdapter;

    public twoTextViewAdapter(List<dakaInfo> infos, Context context) {
        this.infos = infos;
        this.inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return infos == null ? 0 : infos.size();
    }

    @Override
    public Object getItem(int position) {
        return infos.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        @SuppressLint({"ViewHolder", "InflateParams"}) View view = inflater.inflate(R.layout.two_textview_item, null);
        TextView name, info;
        dakaInfo dakaInfo = (dakaInfo) getItem(position);
        name = view.findViewById(R.id.name);
        info = view.findViewById(R.id.info);
        info.setText(dakaInfo.getInfo());
        name.setText(dakaInfo.getName());
        return view;
    }


}
